home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / g_man / cat3 / OpenGL / glulookat.z / glulookat
Encoding:
Text File  |  2002-10-03  |  3.8 KB  |  128 lines

  1.  
  2.  
  3.  
  4. gggglllluuuuLLLLooooooookkkkAAAAtttt((((3333GGGG))))                  OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                  gggglllluuuuLLLLooooooookkkkAAAAtttt((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      gggglllluuuuLLLLooooooookkkkAAAAtttt - define a viewing transformation
  10.  
  11.  
  12. CCCC SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  13.      void gggglllluuuuLLLLooooooookkkkAAAAtttt( GLdouble _e_y_e_X,
  14.                      GLdouble _e_y_e_Y,
  15.                      GLdouble _e_y_e_Z,
  16.                      GLdouble _c_e_n_t_e_r_X,
  17.                      GLdouble _c_e_n_t_e_r_Y,
  18.                      GLdouble _c_e_n_t_e_r_Z,
  19.                      GLdouble _u_p_X,
  20.                      GLdouble _u_p_Y,
  21.                      GLdouble _u_p_Z )
  22.  
  23.  
  24. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  25.      _e_y_e_X, _e_y_e_Y, _e_y_e_Z
  26.                      Specifies the position of the eye point.
  27.  
  28.      _c_e_n_t_e_r_X, _c_e_n_t_e_r_Y, _c_e_n_t_e_r_Z
  29.                      Specifies the position of the reference point.
  30.  
  31.      _u_p_X, _u_p_Y, _u_p_Z   Specifies the direction of the _u_p vector.
  32.  
  33. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  34.      gggglllluuuuLLLLooooooookkkkAAAAtttt creates a viewing matrix derived from an eye point, a reference
  35.      point indicating the center of the scene, and an _U_P vector.
  36.  
  37.      The matrix maps the reference point to the negative _z axis and the eye
  38.      point to the origin.  When a typical projection matrix is used, the
  39.      center of the scene therefore maps to the center of the viewport.
  40.      Similarly, the direction described by the _U_P vector projected onto the
  41.      viewing plane is mapped to the positive _y axis so that it points upward
  42.      in the viewport.  The _U_P vector must not be parallel to the line of sight
  43.      from the eye point to the reference point.
  44.  
  45.      Let
  46.  
  47.  
  48.      F = (||( centerZcenterYcenterX   ---   eyeZeyeYeyeX  )||)
  49.      Let _U_P be the vector (upX,upY,upZ).
  50.  
  51.      Then normalize as follows: f = ||F||F_____
  52.  
  53.      UP' = ||UP||UP______
  54.  
  55.  
  56.  
  57.  
  58.  
  59.                                                                         PPPPaaaaggggeeee 1111
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. gggglllluuuuLLLLooooooookkkkAAAAtttt((((3333GGGG))))                  OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                  gggglllluuuuLLLLooooooookkkkAAAAtttt((((3333GGGG))))
  67.  
  68.  
  69.  
  70.      Finally, let s = f x UP', and u = s x f.
  71.  
  72.  
  73.  
  74.      M is then constructed as follows:  M = (||||(  0-f[0]u[0]s[0]    0-f[1]u[1]s[1]    0-f[2]u[2]s[2]  1000  )||||)
  75.      and gggglllluuuuLLLLooooooookkkkAAAAtttt is equivalent to
  76.  
  77.           glMultMatrixf(M);
  78.           glTranslated (-eyex, -eyey, -eyez);
  79.  
  80.  
  81. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  82.      ggggllllFFFFrrrruuuussssttttuuuummmm, gggglllluuuuPPPPeeeerrrrssssppppeeeeccccttttiiiivvvveeee
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.                                                                         PPPPaaaaggggeeee 2222
  123.  
  124.  
  125.  
  126.